<link rel="stylesheet" href="<?php echo APP_TEMPLATES_URL;?>/css/public.css" />
<style>
	body,
	html {
		background: #F4F4F4 !important;
	}
	
	.indexm {
		display: none;
	}
	.file {
		position: absolute;
		top: 0;
		right: 80px;
		height: 24px;
		filter: alpha(opacity: 0);
		opacity: 0;
		width: 260px
	}
</style>

<body>  

</body> 

<!-- 导航 -->
<div class="mui-bar mui-bar-nav bj">
    <a href="<?php echo urlApp('member','index'); ?>">
	<button id="zhuce" class="mui-btn mui-btn-link mui-btn-nav mui-pull-left zys">
				<img style=" max-width: 70%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/back.png" />
			</button></a>

	<button class="mui-btn mui-btn-link mui-btn-nav mui-pull-right zys rigbtn">
				<a href="#">
					<img style=" max-width: 70%; vertical-align: middle;" src="<?php echo APP_TEMPLATES_URL;?>/images/m_dian.png" />
                </a>
			</button>

	<h1 class="mui-title"><label style="font-size: 18px;vertical-align: middle; line-height: 44px;">个人资料</label></h1>
</div>
<!-- 主体内容 -->
<section>
		<ul class="across">
			<li class="side">
				<div class="countone">
					<a href="#">
						<label>头像设置</label>
						<label style="text-align: right;">
							<div id="localImag">					
				                 <img style="max-width: 100%; margin: 10px; width: 65px; height: 65px;" id="preview" src="<?php echo empty($output['member_info']['member_avatar']) ? APP_TEMPLATES_URL.'/images/m_03.png':UPLOAD_SITE_URL.DS.ATTACH_AVATAR.DS.$output['member_info']['member_avatar'];?>" />			        
					        </div>

							<!--ajax表单-->
							<form action="index.php?act=member&op=ajax_upload_image" method="post" enctype="multipart/form-data">
								<div>
									<div>
										<input type="file" name="image" id="image" accept="image/*" class="upload-input" style="display: none" />
										<!--<input style="display:none" type="file" name="file" id="file_head" onchange="javascript:setImagePreview();" />-->
									</div>
									<div>
										<div id="DivUp" style="display: none">
											<input type="submit" data-inline="true" id="BtnUp" value="确认上传" data-mini="true" />
										</div>
									</div>
								</div>
							</form>
							<!--ajax提交-->
							<script>
								//单图
								$('#image').live('change',function(){
									//为FormData对象添加数据
									var data = new FormData();
									//留以后多图上传用
									var max_num=0;
									$.each($('#image')[0].files, function(i, file) {
										data.append('image'+i, file);
										max_num++;
									});
									var url='index.php?act=member&op=ajax_upload_image&max_num='+max_num;
									//发送数据
									$.ajax({
										url:url,
										type:'POST',
										data:data,
										dataType:'JSON',
										cache: false,
										contentType: false,		//不可缺参数
										processData: false,		//不可缺参数
										success:function(data){
											if(data.error){
												alert(data.error);return;
											}else if(data.image){
												//alert(data.image);
												$('#preview').attr("src",data.image); //更改图片
												window.location.reload(); //刷新当前页
												return
											}
										},
										error:function(){
											alert('AJAX错误，请联系技术人员');return;
										}
									});
								});
							</script>

						</label>
					</a>
				</div>
			</li>
			<li class="side notactive">
				<div class="countone notone">
					<a href="#">
						<label>用户名</label>
						<label style="text-align: right; color: #999;">
								<?php  echo (intval($output['member_info']['member_name'])>0 && strlen($output['member_info']['member_name'])==11) ?substr($output['member_info']['member_name'],0,3).'****'.substr($output['member_info']['member_name'],-4):$output['member_info']['member_name'];?>
								</label>
					</a>
				</div>
			</li>
			<li class="side notactive">
				<div class="countone notone">
					<a href="#">
						<label>昵称设置</label>
						<label style="text-align: right; color: #999;">
								<input type="text" id="member_nickname" name="member_nickname" value="<?php echo $output['member_info']['member_nickname']?>" style="text-align:right;font-size: 14px; width: 100%;vertical-align: middle;border: 0; height: 45px;" placeholder="请填写" />
									
								</label>
					</a>
				</div>
			</li>
			<li class="side">
				<div class="countone">
					<a href="index.php?act=member&op=setsex">
						<label>性别</label>
						<?php $sexarr = array(''=>'保密','0'=>'女','1'=>'男');?>
						<label style="text-align: right; color: #666;"><?php echo $sexarr[$output['member_info']['member_sex']];?></label>
					</a>
				</div>
			</li>
			<li class="side">
				<div class="countone">
					<a href="index.php?act=member&op=address">
						<label>我的地址</label>
						<label style="text-align: right; color: #999;"></label>
					</a>
				</div>
			</li>
		</ul>
				<div style="height: 10px; background: #F4F4F4; clear: both;"></div>				
				<ul class="across">
					<li class="side">
						<div class="countone">
							<a href="index.php?act=member&op=realname_attestation">
								<label>实名认证</label>
                                <?php if ($output['member_info']['member_idcard']) {?>
                                    <label style="text-align: right; color: #999;">已认证</label>
                                <?php }else{ ?>
                                    <label style="text-align: right; color: #999;">去完善信息</label>
                                <?php } ?>

							</a>
						</div>
					</li>
					<li class="side">
						<div class="countone">
							<a href="index.php?act=member&op=accountsafe">
								<label>账户安全</label>
								<label style="text-align: right; color: #999;">可修改密码</label>
							</a>
						</div>
					</li>
				</ul>
				<div style="height: 10px; background: #F4F4F4; clear: both;"></div>	
				<input type="hidden" id="member_id" value="<?php echo $output['member_info']['member_id'];?>" />
			</div>
			
	    </section>


<div class="kuankuan"></div>
<div class="rightmenu">
	<img style="width: 17px;float: right; margin-top: -12px; margin-right: 5px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03.png" />
	<ul>
		<li>
			<a href="index.php"><img style="vertical-align: middle;width: 25px; margin: 0 10px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03-02.png" />首页</a>
		</li>
		<li>
			<a href="index.php?act=temp&op=issue"><img style="vertical-align: middle;width: 25px; margin: 0 10px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03-03.png" />常见问题</a>
		</li>
		<li style="display: none;">
			<a href="index.php?act=temp&op=issue"><img style="vertical-align: middle;width: 25px; margin: 0 10px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03-04.png" />安全保障</a>
		</li>
		<li style="display: none;">
			<a href="index.php?act=temp&op=msg_center"><img style="vertical-align: middle;width: 25px; margin: 0 10px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03-05.png" />客服热线</a>
		</li>
		<li>
			<a href="index.php?act=temp&op=feedback"><img style="vertical-align: middle;width: 25px; margin: 0 10px;" src="<?php echo APP_TEMPLATES_URL;?>/images/some_03-06.png" />我要反馈</a>
		</li>
	</ul>
</div>

<style type="text/css">
	.rightmenu {
		display: none;
		position: fixed;
		background: #333333;
		top: 55px;
		right: 10px;
		width: 140px;
		z-index: 66;
		overflow: visible !important;
	}
	
	.rightmenu ul {
		float: left;
	}
	
	.rightmenu li {
		float: left;
		width: 100%;
		border-bottom: 1px solid #000000;
		height: 50px;
	}
	
	.rightmenu a {
		height: 50px;
		line-height: 50px;
		color: #dddddd;
		font-size: 15px;
	}
	
	.rightmenu li:active {
		background: rgba(0, 0, 0, 0.29);
	}
	
	.kuankuan {
		display: none;
		position: fixed;
		width: 100%;
		height: 100%;
		z-index: 20;
		top: 0;
	}
</style>
<script>
	$(function() {
		$(".rigbtn").click(function() {
			test();
		});
		$(".kuankuan").click(function() {
			test();
		});

		$("#member_nickname").change(function(){
			var member_id = $("#member_id").val();
			var ajaxurl = 'index.php?act=member&op=updatenickname';
			var nickname = $("#member_nickname").val();
			$.ajax({
				type: "POST",
				url: ajaxurl,
				data : {
    				member_id : member_id,
    				member_nickname : nickname
    			},
    			dataType : "json",
				success: function(rs){
                if(!rs.datas.error) {
                	window.location.href = 'index.php?act=member&op=profile';
                } 
			    }
			});
		});
	});

	function test() {
		$(".rightmenu").slideToggle();
		$(".kuankuan").slideToggle();
	}
</script>